<template>
  <div class="header">主应用</div>
  <div class="container">
    <div class="sidebar">
      <div class="nav" :style="{ backgroundColor: route.path.startsWith('/child-vue-app1/') ? '#4977FC' : '#FFFFFF' }">
        <RouterLink to="/child-vue-app1/home">child-vue-app1</RouterLink>
      </div>
      <div class="nav" :style="{ backgroundColor: route.path.startsWith('/child-vue-app2/') ? '#4977FC' : '#FFFFFF' }">
        <RouterLink to="/child-vue-app2/home">child-vue-app2</RouterLink>
      </div>
    </div>

    <div class="content-box">
      <RouterView />
    </div>
  </div>
</template>

<script setup>
import { RouterLink, RouterView } from 'vue-router'
import { useRoute } from 'vue-router'

const route = useRoute()
</script>

<style scoped>
.header {
  width: 600px;
  height: 40px;
  margin: 20px auto 0 auto;
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center; 
}

.container {
  width: 600px;
  height: 400px;
  margin: 20px auto 0 auto;
  border: 1px solid #000000;
  display: flex;
}

.sidebar {
  width: 149px;
  border-right: 1px solid #000000;
  height: 100%;
}

.nav {
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;  
  border-bottom: 1px solid #000000;
}

.content-box {
  width: 450px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

::v-deep(a) {
  color: #000000;
  font-size: 16px;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}

::v-deep(a:hover) {
  background-color: #4977FC;
}
</style>
